//
//  DDMoneybagHomepageService.m
//  DingDongZP
//
//  Created by 杨政涛 on 16/10/18.
//  Copyright © 2016年 51ledian.com. All rights reserved.
//

#import "DDMoneybagHomepageService.h"

@implementation DDMoneybagHomepageService

- (void)queryMoneybagHomepageSuccessBlock:(successBlock)successBlock
                                failBlock:(faileBlock)failBlock
{
    NSString *URLString = [[DDAPIGenerate sharedInstance] NewAPI:@"money.php?act=getQianbao"];
        
    NSMutableDictionary *params = [@{} mutableCopy];
   
    DDNetWorkManager *manager = [DDNetWorkManager shareManager];
    
    [manager POST:URLString parameters:params success:successBlock failure:failBlock];
}

- (void)queryMoneybagDetailWithPage:(NSInteger)page withType:(NSString *)type  SuccessBlock:(successBlock)successBlock
                              failBlock:(faileBlock)failBlock
{
    NSString *URLString = [[DDAPIGenerate sharedInstance] NewAPI:@"money.php?act=getDetailList"];
    
    NSMutableDictionary *params = [@{} mutableCopy];

    if (!params[@"page"]) {
        [params setObject:@(page) forKey:@"page"];
    }
    
    if (!params[@"type"]) {
        [params setObject:type forKey:@"type"];
    }
    
    DDNetWorkManager *manager = [DDNetWorkManager shareManager];
    
    [manager POST:URLString parameters:params success:successBlock failure:failBlock];
}

- (void)queryRechargeTypeSuccessBlock:(successBlock)successBlock
                            failBlock:(faileBlock)failBlock
{
    NSString *URLString = [[DDAPIGenerate sharedInstance] NewAPI:@"money.php?act=getPayArray"];
    
    NSMutableDictionary *params = [@{} mutableCopy];
    
    DDNetWorkManager *manager = [DDNetWorkManager shareManager];
    
    [manager POST:URLString parameters:params success:successBlock failure:failBlock];
}


- (void)queryShareAccountSuccessBlock:(successBlock)successBlock
                            failBlock:(faileBlock)failBlock
{

    NSString *URLString = [[DDAPIGenerate sharedInstance] NewAPI:@"money.php?act=getShareAcountList"];
    
    NSMutableDictionary *params = [@{} mutableCopy];
    
    DDNetWorkManager *manager = [DDNetWorkManager shareManager];
    
    [manager POST:URLString parameters:params success:successBlock failure:failBlock];
}


- (void)saveShareAccountWithid:(NSString *)currentID withRemark:(NSString *)remark withShare_mobile:(NSString *)share_mobile SuccessBlock:(successBlock)successBlock failBlock:(faileBlock)failBlock
{

    NSString *URLString = [[DDAPIGenerate sharedInstance] NewAPI:@"money.php?act=putShareAcount"];
    
    NSMutableDictionary *params = [@{} mutableCopy];
    
    if (!params[@"id"]) {
        [params setObject:currentID forKey:@"id"];
    }
    
    if (!params[@"remark"]) {
        [params setObject:remark forKey:@"remark"];
    }
    
    if (!params[@"share_mobile"]) {
        [params setObject:share_mobile forKey:@"share_mobile"];
    }
    
    DDNetWorkManager *manager = [DDNetWorkManager shareManager];
    
    [manager POST:URLString parameters:params success:successBlock failure:failBlock];
}

- (void)deleteAccountWithid:(NSString *)currentID SuccessBlock:(successBlock)successBlock failBlock:(faileBlock)failBlock
{
    NSString *URLString = [[DDAPIGenerate sharedInstance] NewAPI:@"money.php?act=delShareAcount"];
    
    NSMutableDictionary *params = [@{} mutableCopy];
    
    if (!params[@"id"]) {
        [params setObject:currentID forKey:@"id"];
    }
    
    DDNetWorkManager *manager = [DDNetWorkManager shareManager];
    
    [manager POST:URLString parameters:params success:successBlock failure:failBlock];
}

- (void)prePayForWeiXinToSeverWithid:(NSString *)payArryID SuccessBlock:(successBlock)successBlock failBlock:(faileBlock)failBlock
{

    NSString *URLString = [[DDAPIGenerate sharedInstance] NewAPI:@"weixin_pay.php?act=createOrder"];
    
    NSMutableDictionary *params = [@{} mutableCopy];
    
    if (!params[@"id"]) {
        [params setObject:payArryID forKey:@"id"];
    }
    
    DDNetWorkManager *manager = [DDNetWorkManager shareManager];
    
    [manager POST:URLString parameters:params success:successBlock failure:failBlock];
}

@end
